package com.ilearn.limiter.controller;

import com.ilearn.limiter.aop.annocation.RateLimitAspect;
import com.ilearn.limiter.dto.ResponseDTO;
import com.ilearn.limiter.utils.Result;
import com.ilearn.limiter.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: lyndon
 * @version: 1.0
 * @date: 2019/3/19
 */
@Controller
@RequestMapping("/person")
public class UserAopController {
    @Autowired
    @RequestMapping("getUserList2")
    @ResponseBody
    @RateLimitAspect
    public Result getUserListAop() {
        ResponseDTO responseDTO = ResponseDTO.builder()
                .id(2)
                .name("zyx")
                .age(39)
                .build();
        return ResultUtil.success(responseDTO);
    }
}